import u from "../utils";
import { TASK } from "../constants";

const _api = u.api(TASK);
const userid = (window.location.href.split('userid=')[1] || '').split("&")[0] || '';
export default {
    splitKey: params => _api('getTaskListSplitKey', { data: { ...params, userid } }),
    left: appid => _api('getTaskTypeList', { data: { appid, userid } }),
    topCount: (appid) => _api('getTaskTopCount', { data: { appid: appid ? appid : '', userid } }),
    saveTask: params => _api('saveTask', { data: { ...params, userid } }),
    saveAppGroup: params => _api('saveAppGroup', { data: { ...params, userid }, type: 'post' }),
    deleteAppGroup: params => _api('deleteAppGroup', { data: { ...params, userid }, type: 'post' }),
    task: params => _api('getTaskInfo', { data: { ...params, userid } }),
    path: params => _api('getTaskPathInfo', { data: { ...params, userid } }),
    page: params => _api('getTaskPageInfo', { data: { ...params, userid } }),
    excel: params => _api('getExcelPageViewInfo', { data: { ...params, userid } }),
    getExcelPageBaseInfo: params => _api('getExcelPageBaseInfo', { data: params }),
    getExcelPageDataSource: params => _api('getExcelPageDataSource', { data: params }),
    getExcelPageUserInfo: params => _api('getExcelPageUserInfo', { data: params }),
    getExcelPageFieldAssign: params => _api('getExcelPageFieldAssign', { data: params }),
    getExcelPageDetailProps: params => _api('getExcelPageDetailProps', { data: params }),
    getExcelPageAutoSaveInfo: params => _api('getExcelPageAutoSaveInfo', { data: params }),
    getExcelPageFieldAssignDatas: params => _api('getExcelPageFieldAssignDatas', { data: params }),
    getExcelPageCustomCode: params => _api('getExcelPageCustomCode', { data: params }),
    template: params => _api('getExcelTemplate', { data: { ...params, userid } }),
    log: data => _api('getTaskLogInfo', { data }),
    submit: params => _api('submitTask', { data: { ...params, userid }, type: 'post' }),
    issue: params => _api("issueTask", { type: 'post', data: { ...params, userid } }),
    saveData: params => _api('saveTaskData', { type: 'post', data: { ...params, userid } }),
    autoSaveData: params => _api('autoSaveTaskData', { type: 'post', data: { ...params, userid } }),
    reject: nodeid => _api('rejectTask', { data: { nodeid } }),
    undo: (node) => _api('undoTask', { data: node }),
    forcedCollect: (node) => _api('forcedCollectTask', { data: node, type: 'post' }),
    resetCollect: (node) => _api('resetCollectTask', { data: node, type: 'post' }),
    showDetail: params => _api("isShowDetail", { type: 'post', data: { ...params, userid } }),
    getAppPathid: params => _api("getAppPathid", { data: { ...params, userid } }),
    batchReject: nodeid => _api('batchRejectTask', { data: { nodeid } }),
    checkApp: params => _api('checkApp', { data: { ...params, userid } }),
    queryFieldProps: (id) => _api(`queryFieldProps`, { data: { id }, type: 'get' }),
    getFieldAssignData: params => _api('getFieldAssignData', { data: { ...params, userid }, type: 'post' }),
    getEdcPageSheet: params => _api('getEdcPageSheet', { data: { ...params, userid }, type: 'post' }),
    getLoadResource:params => _api('getLoadResource', { data: { ...params, userid } }),

}